<template>
  <div class="header">
    <div class="header-left">
      <img :src="squareUrl" alt="logo">
      <el-button icon="el-icon-menu" @click="controlMenu(!isOpenAside)"></el-button>
    </div>
    <div class="header-right">
      <el-button type="text">
        <el-dropdown trigger="click">
        <span class="el-dropdown-link">
          更多<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="exit">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-button>
      <div>
        <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></el-avatar>
      </div>
    </div>
  </div>
</template>

<script>
/**
 * HomeHeader
 * @module '@/component/HomeHeader'
 * @desc 页面头栏
 * @author 开朗的不得了
 * @date 2023年3月1日19点41分
 * @param {Object} [title]    - 参数说明
 * @param {String} [columns] - 参数说明
 * @example
 *  <header/>
 **/

export default {
  name: "HomeHeader",
  data(){
    return{
      squareUrl: "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
      isOpenAside: false,
    }
  },
  mounted() {

  },
  methods:{
    // 控制Aside-Menu的展开或闭合
    controlMenu(order){
      this.$bus.$emit('changeCollapse',order);
      this.isOpenAside = !this.isOpenAside;
    },
    // 退出登录
    exit(){
      console.log(11)
      window.sessionStorage.removeItem('ADMIN');
      this.$router.go(0);
    }
  }
}
</script>

<style lang="less" scoped>
  .display(){
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .header{
    .display();
    background-color: ghostwhite;
    border-bottom: 1px solid rgba(196, 196, 196, 0.99);
  }
  .header-left {
    min-width: 140px;
    .display();
    img {
      width: 60px;
      height: 60px;
    }
    font-size: 20px;
  }
  .header-right{
    min-width: 140px;
    .display();
  }

</style>